//
//  UIImage+utils.h
//  helper
//
//  Created by huangyi on 12-10-29.
//  Copyright (c) 2012年 huangyi. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, ImageResizeMode) {
    ImageResizeModeAspectFill,
    ImageResizeModeAspectFit,
    ImageResizeModeExpand,
    ImageResizeModeCenter,
};

@interface UIImage (utils)

+(UIImage*)imageWithSize:(CGSize)size;
+(UIImage*)imageWithColor:(UIColor*)color;
+(UIImage*)imageWithString:(NSString*)string font:(UIFont*)font;

-(UIImage *)imageMaskedWithImage:(UIImage *)maskImage;

-(UIImage*)resizeImage:(CGSize)size;
-(UIImage*)resizeImage:(CGSize)size mode:(ImageResizeMode)mode;
-(UIImage*)rotateImage:(CGFloat)degree;
-(UIImage*)cropImage:(CGRect)rect;

-(UIImage*)trimImage;
-(UIImage*)tintColor:(UIColor *)color;

-(UIColor*)colorAtPoint:(CGPoint)point;

@end

extern UIImage* UIImageObj(NSData* data);
extern UIImage* BitmapString(NSString *str);
